<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>添加用户</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/base.css">
	<script  src="${pageContext.request.contextPath}/js/jquery/jquery-3.1.1.min.js" type="text/javascript"></script>
	<style type="text/css">
		body{height:100%;width:100%;margin:0;padding:0;}
	</style>
	
	<script type="text/javascript">
	$(document).ready(function() {
		var msg = "${msg}";
		if(msg!="") {
			alert(msg);
		}
	});
	function addUser() {
		var username = $("#username").val();
		if(username=="") {
			alert("用户名不能为空！");
			return;
		}
		
		var password = $("#password").val();
		if(password=="") {
			alert("密码不能为空！");
			return;
		}
		
		var mobile = $("#mobile").val();
		if(mobile.length!=11) {
			alert("请输入正确的手机号码！");
			return;
		}
		
		$("#form1").submit();
	}
	</script>

  </head>
  
  <body>
  	<form id="form1" action="${pageContext.request.contextPath }/addUser.do" method="post">
  	<table>
  		<tr>
  			<td>用户名：</td>
  			<td><input type="text" id="username" name="username" maxlength="20" /></td>
  		</tr>
  		<tr>
  			<td>真实姓名：</td>
  			<td><input type="text" id="realName" name="realName" maxlength="20" /></td>
  		</tr>
  		<tr>
  			<td>公司名称：</td>
  			<td><input type="text" id="company" name="company" maxlength="20" /></td>
  		</tr>
  		<tr>
  			<td>电话：</td>
  			<td><input type="text" id="mobile" name="mobile" maxlength="11" /></td>
  		</tr>
  		<tr>
  			<td>上级：</td>
  			<td>
  				<select name="fatherId" id="fatherId">
  					<option value="1">客户一号</option>
  					<option value="2">客户二号</option>
  				</select>
  			</td>
  		</tr>
  		<tr>
  			<td>密码：</td>
  			<td><input type="password" id="password" name="password" maxlength="20" /></td>
  		</tr>
  		<tr>
  			<td>角色：</td>
  			<td>
  			<c:forEach items="${roleList }" var="roleBean">
  			<input type="checkbox" name="role" value="${roleBean.roleId }" />${roleBean.roleName }
  			</c:forEach>
  			</td>
  		</tr>
  		<tr>
  			<td colspan="2">
  				<input type="button" value="添      加" onclick="addUser()" />
  			</td>
  		</tr>
  	
  	</table>
  	</form>
  </body>
</html>
